// https://github.com/shelljs/shelljs
require('shelljs/global')

var path = require('path')
var webpack = require('webpack')
var utils = require('./utils')
var webpackConfig = require('./webpack.config.js')

let env = utils.buildConfig(process.argv[2])
console.log(
    '  Tip:\n' +
    '  vue+webpack.\n'
)

var assetsPath = './public/'+env
rm('-rf', assetsPath)
mkdir('-p', assetsPath)


webpack(webpackConfig, function (err, stats) {
    if (err) throw err
    process.stdout.write(stats.toString({
            colors: true,
            modules: false,
            children: false,
            chunks: false,
            chunkModules: false
        }) + '\n')
})
console.log();